package com.hjy.hjyojbackendjudgeservice.judge.codesandbox.impl;

import com.hjy.hjyojbackendjudgeservice.judge.codesandbox.CodeSandBox;
import com.hjy.hjyojbackendjudgeservice.model.codesandbox.ExeccuteCodeRequest;
import com.hjy.hjyojbackendjudgeservice.model.codesandbox.ExeccuteCodeResponse;
import com.hjy.hjyojbackendjudgeservice.model.codesandbox.JudgeInfo;
import com.hjy.hjyojbackendjudgeservice.model.enums.JudgeInfoMessageEnum;
import com.hjy.hjyojbackendjudgeservice.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * 示例代码沙箱（仅为了跑通业务流程）
 */
public class ExampleCodeSandbox implements CodeSandBox {
    @Override
    public ExeccuteCodeResponse execcuteCode(ExeccuteCodeRequest execcuteCodeRequest) {
        List<String> inputList = execcuteCodeRequest.getInputList();
        ExeccuteCodeResponse execcuteCodeResponse = new ExeccuteCodeResponse();
        execcuteCodeResponse.setOutputList(inputList);
        execcuteCodeResponse.setMessage("测试执行成功");
        execcuteCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());

        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setTime(100L);
        judgeInfo.setMemory(100L);
        execcuteCodeResponse.setJudgeInfo(judgeInfo);
        return execcuteCodeResponse;
    }
}
